from pydantic import BaseModel
from typing import List, Optional
from datetime import datetime
from api.schemas.compile import CompileOptions, FileInfo

class HistoryItem(BaseModel):
    """历史记录项模型"""
    task_id: str
    status: str
    created_at: datetime
    completed_at: Optional[datetime]
    options: CompileOptions
    input_files: List[FileInfo]
    output_files: Optional[List[FileInfo]]
    error_message: Optional[str]

class HistoryListResponse(BaseModel):
    """历史记录列表响应模型"""
    total: int
    items: List[HistoryItem]

class HistoryDetailResponse(BaseModel):
    """历史记录详情响应模型"""
    item: HistoryItem
    log: str
